home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / CEGUISDK-0.4.1-VC6-Native.exe / {app} / include / elements / CEGUICheckbox.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-06-04  |  5.5 KB  |  178 lines

  1. /************************************************************************
  2.     filename:     CEGUICheckbox.h
  3.     created:    13/4/2004
  4.     author:        Paul D Turner
  5.     
  6.     purpose:    Interface to base class for Checkbox Widget
  7. *************************************************************************/
  8. /*************************************************************************
  9.     Crazy Eddie's GUI System (http://www.cegui.org.uk)
  10.     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
  11.  
  12.     This library is free software; you can redistribute it and/or
  13.     modify it under the terms of the GNU Lesser General Public
  14.     License as published by the Free Software Foundation; either
  15.     version 2.1 of the License, or (at your option) any later version.
  16.  
  17.     This library is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20.     Lesser General Public License for more details.
  21.  
  22.     You should have received a copy of the GNU Lesser General Public
  23.     License along with this library; if not, write to the Free Software
  24.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25. *************************************************************************/
  26. #ifndef _CEGUICheckbox_h_
  27. #define _CEGUICheckbox_h_
  28.  
  29. #include "CEGUIBase.h"
  30. #include "elements/CEGUIButtonBase.h"
  31. #include "elements/CEGUICheckboxProperties.h"
  32.  
  33.  
  34. #if defined(_MSC_VER)
  35. #    pragma warning(push)
  36. #    pragma warning(disable : 4251)
  37. #endif
  38.  
  39.  
  40. // Start of CEGUI namespace section
  41. namespace CEGUI
  42. {
  43.  
  44. /*!
  45. \brief
  46.     Base class providing logic for Check-box widgets
  47. */
  48. class CEGUIEXPORT Checkbox : public ButtonBase
  49. {
  50. public:
  51.     static const String EventNamespace;                //!< Namespace for global events
  52.  
  53.     /*************************************************************************
  54.         Event name constants
  55.     *************************************************************************/
  56.     // generated internally by Window
  57.     static const String EventCheckStateChanged;            //!< The check-state of the widget has changed.
  58.  
  59.  
  60.     /*************************************************************************
  61.         Accessor Functions
  62.     *************************************************************************/
  63.     /*!
  64.     \brief
  65.         return true if the check-box is selected (has the checkmark)
  66.  
  67.     \return
  68.         true if the widget is selected and has the check-mark, false if the widget
  69.         is not selected and does not have the check-mark.
  70.     */
  71.     bool    isSelected(void) const                        {return d_selected;}
  72.  
  73.  
  74.     /*************************************************************************
  75.         Manipulator Functions
  76.     *************************************************************************/
  77.     /*!
  78.     \brief
  79.         set whether the check-box is selected or not
  80.  
  81.     \param select
  82.         true to select the widget and give it the check-mark.  false to de-select the widget and
  83.         remove the check-mark.
  84.  
  85.     \return
  86.         Nothing.
  87.     */
  88.     void    setSelected(bool select);
  89.  
  90.  
  91.     /*************************************************************************
  92.         Construction / Destruction
  93.     *************************************************************************/
  94.     /*!
  95.     \brief
  96.         Constructor for Checkbox class.
  97.     */
  98.     Checkbox(const String& type, const String& name);
  99.  
  100.  
  101.     /*!
  102.     \brief
  103.         Destructor for Checkbox class.
  104.     */
  105.     virtual ~Checkbox(void);
  106.  
  107.  
  108. protected:
  109.     /*************************************************************************
  110.         New event handlers
  111.     *************************************************************************/
  112.     /*!
  113.     \brief
  114.         event triggered internally when state of check-box changes
  115.     */
  116.     virtual void    onSelectStateChange(WindowEventArgs& e);
  117.  
  118.  
  119.     /*************************************************************************
  120.         Overridden event handlers
  121.     *************************************************************************/
  122.     virtual void    onMouseButtonUp(MouseEventArgs& e);
  123.  
  124.  
  125.     /*************************************************************************
  126.         Implementation Functions
  127.     *************************************************************************/
  128.     /*!
  129.     \brief
  130.         Add check-box specific events
  131.     */
  132.     void    addCheckboxEvents(void);
  133.  
  134.  
  135.     /*!
  136.     \brief
  137.         Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
  138.  
  139.     \param class_name
  140.         The class name that is to be checked.
  141.  
  142.     \return
  143.         true if this window was inherited from \a class_name. false if not.
  144.     */
  145.     virtual bool    testClassName_impl(const String& class_name) const
  146.     {
  147.         if (class_name==(const utf8*)"Checkbox")    return true;
  148.         return ButtonBase::testClassName_impl(class_name);
  149.     }
  150.  
  151.  
  152.     /*************************************************************************
  153.         Implementation Data
  154.     *************************************************************************/
  155.     bool        d_selected;                    //!< true if check-box is selected (has checkmark)
  156.  
  157. private:
  158.     /*************************************************************************
  159.         Static Properties for this class
  160.     *************************************************************************/
  161.     static CheckboxProperties::Selected    d_selectedProperty;
  162.  
  163.  
  164.     /*************************************************************************
  165.         Private methods
  166.     *************************************************************************/
  167.     void    addCheckboxProperties(void);
  168. };
  169.  
  170. } // End of  CEGUI namespace section
  171.  
  172.  
  173. #if defined(_MSC_VER)
  174. #    pragma warning(pop)
  175. #endif
  176.  
  177. #endif    // end of guard _CEGUICheckbox_h_
  178.